<template>
	<sc-form ref="formRef"
			 v-model="form"
			 :config="config"
			 :loading="loading"
			 >
	</sc-form>
</template>

<script setup lang="ts">
import { ref, reactive, getCurrentInstance } from 'vue'
import {ArrowDown, ArrowUp} from "@element-plus/icons-vue";
import data from '@/views/test/table2/json/data.json'
import columns from '@/views/test/table2/json/columns.json'
const formRef = ref<any>(null);
const { proxy: { $API } } = getCurrentInstance()

console.log($API.simple.list)
const config = ref({
	labelWidth: '100',
	labelPosition: 'right',
	size: 'default',
	emptySize: 0,
	emptySpan: 6,
	mode:'search',
	span: 6,
	formItems: [
		{
			label: '表格选择器',
			name: 'tableselect',
			value: {},
			component: 'tableselect',
			options: {
				apiObj: $API.simple.list,
				column: columns,
				props: {
					label: 'user',
					value: 'id',
					keyword: 'keyword'
				}
			}
		},
		{
			label: '输入框',
			name: 'name',
			value: '',
			span:6,
			component: 'input',
			attrs: {
				placeholder: '请输入内容'
			},
		},
		{
			label: '输入框',
			name: 'name',
			value: '',
			span:6,
			component: 'input',
			attrs: {
				placeholder: 'Activity name'
			},
		},
		{
			label: '输入框',
			name: 'name',
			value: '',
			span:6,
			component: 'input',
			attrs: {
				placeholder: 'Activity name'
			},
		},
		{
			label: '输入框',
			name: 'name',
			value: '',
			span:6,
			component: 'input',
			attrs: {
				placeholder: 'Activity name'
			},
		},
		{
			label: '日期/时间',
			name: 'date',
			value: '',
			span:6,
			component: 'date-picker',
			attrs: {
				type: 'datetime',
				valueFormat: 'YYYY-MM-DD HH:mm:ss'
			},
			rules: [{ required: true, message: 'Please input Data', trigger: 'change' }]
		}
		,
		{
			label: '日期/时间',
			name: 'date',
			value: '',
			span:6,
			component: 'date-picker',
			attrs: {
				type: 'datetime',
				valueFormat: 'YYYY-MM-DD HH:mm:ss'
			},
			rules: [{ required: true, message: 'Please input Data', trigger: 'change' }]
		}

	]
})
const form = {

}
//const formOptions = reactive<FormItemRows[]>(formItems);
const emit = defineEmits(['onSearch']);

const onSearch = () => {
	console.log("on")
	emit('onSearch', {id:1});
};





</script>
<style lang="scss" scoped>

</style>
